﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook.Web;
using System.Data.SqlClient;

public partial class CV : LutefiskPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set the Current Musician's Data to the Session UID (the musician we requested to view)
        CurrentMusician = Musician.CreateMusician(Session["uid"].ToString());

        // Logic to show the CV if there is one available, and to show an alternative box if there is not a CV available.
        if (CurrentMusician.HasCV)
        {
            cvHeaderLabel.Text = cvHeaderLabel.Text.Replace("XXX", CurrentMusician.Name);
            cvDescriptionLabel.Text = cvDescriptionLabel.Text.Replace("XXX", CurrentMusician.Name);

            cvViewer.Src = CurrentMusician.CVLocation;

            cvPanel.Visible = true;
            noCVPanel.Visible = false;
        }
        else
        {
            noCVDescriptionLabel.Text = noCVDescriptionLabel.Text.Replace("XXX", CurrentMusician.Name);

            cvPanel.Visible = false;
            noCVPanel.Visible = true;
        }

        // Set text && images based off of CurrentMusician data.
        profileImage.ImageUrl = CurrentMusician.Picture;
        profileLabel.Text = profileLabel.Text.Replace("XXX", CurrentMusician.Name);
    }

    protected void profileClick(object sender, EventArgs e)
    {
        // Navigate to the current musicians profile.
        Session["uid"] = CurrentMusician.UID;
        Lutefisk.DirectPage(Page.Page, "Profile");
    }

    protected void multimediaClick(object sender, EventArgs e)
    {
        // Navigate to the current musician's multimedia.
        Session["uid"] = CurrentMusician.UID;
        Lutefisk.DirectPage(Page.Page, "Multimedia");
    }

    protected void curriculumVitaeClick(object sender, EventArgs e)
    {
        // Navigate to the current musician's cv.
        Session["uid"] = CurrentMusician.UID;
        Lutefisk.DirectPage(Page.Page, "CV");
    }

}